public class Euler17 {

public static void main(String args[]){
String[][] nums={{"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"},
{"", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"}, "\rten\rtwenty\rthirty\rfourty\rfifty\rsixty\rseventy\reighty\rninety".split("\r")};

int len=0;
for(int i=0; i<1000; i++){
if((i/10)%10!=1){len+=nums[0][i%10].length();}else{len+=nums[1][i%10].length();}

if( (i/10)%10==1){ if(i%10==0){ len+=nums[2][1].length();}}else{ len+=nums[2][(i/10)%10].length();}

len+=nums[0][(i/100)%10].length();
if((i/100)%10>0){len+="hundred".length(); if(i%100>0){len+="and".length();}}
}

len+=11;
System.out.println(len);

}

}